package tree;

public class ScanResult {
	/* The node below the matched edge */
	private Node lower;
	private int index;
	private int patternIndex;
	
	public ScanResult(Node lower, int index) {
		if(index > lower.length() || (index == 0 && lower.length() > 0)) {
			throw new IllegalArgumentException("Not permitted for fast-scan");
		}
		this.lower = lower;
		this.index = index;
		this.patternIndex = -1;
	}
	
	public ScanResult(Node lower, int index, int query) {
		this.lower = lower;
		this.index = index;
		this.patternIndex = query;
	}
	
	public boolean isEdge() {
		return !isNode();
	}
	
	public boolean isNode() {
		return index == lower.length();
	}
	
	public Node getLower() {
		return lower;
	}
	public void setLower(Node lower) {
		this.lower = lower;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public int getPatternIndex() {
		return patternIndex;
	}
	public void setQuery(int query) {
		this.patternIndex = query;
	}
	
}
